import asyncio

async def test():
    for i in range(10):
        print(i)
        if i ==3:
            try:
                print(1/0)
            except Exception as e:
                print(e)
        await asyncio.sleep(1)
    print('ending')

async def test2():
    i = 0
    while(True):
        print('test2',i)
        i += 1
        await asyncio.sleep(2)

loop = asyncio.get_event_loop()
tasks = [test(),test2()]
loop.run_until_complete(asyncio.wait(tasks))